package com.kongyz;

import javax.sound.midi.Soundbank;
import java.util.List;

/**
 * @author kongyz
 * @date 2018/6/28 22:02
 * @Description:
 */
public class Demo {
    public static void main(String[] args) {
        Employee CEO=new Employee("老莫","CEO",30000);
        Employee headSales=new Employee("小伟","销售主管",2000);
        Employee technicalDirector=new Employee("小波","技术主管",2000);

        Employee technicalManager=new Employee("小梁","技术经理",15000);

        Employee coder1=new Employee("小刘","程序员",6000);
        Employee coder2=new Employee("小李","程序员",5000);

        CEO.add(headSales);
        CEO.add(technicalDirector);

        technicalDirector.add(technicalManager);

        technicalManager.add(coder1);
        technicalManager.add(coder2);

        System.out.println(CEO);
        printSubordinates(CEO.getSubordinates());
    }

    public static void printSubordinates(List<Employee> model){
        for (Employee employee:model){
            System.out.println(model);
            if(employee.getSubordinates()!=null){
                printSubordinates(employee.getSubordinates());
            }
        }
    }
}
